
set files [glob *.cor *.crd]

foreach file $files {
    set input $file
    puts "Converting $file"
    set output [file rootname $file].pdb
    set pqr [file rootname $file].pqr
    puts "creating pdb $output..."
    exec charmm input=$input output=$output <crd2pdb.inp
    set f [open $output r]
    set pdb [read $f]
    close $f
    set f [open $output w]
    foreach line [split $pdb \n] {
	if [regexp -lineanchor {^ATOM} $line] { puts $f $line} 
    }
    close $f
    puts "creating pqr $pqr..."
    exec pdb2pqr.py --ff=CH19 $output $pqr
}
